package com.cgsd.heyu.entity;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * @author xiaoxing
 * Description 图片数据
 * CreateData: 2020/11/5
 */
public class PhotoEntity implements Parcelable {
    /**
     * 网络图片
     */
    public static final int NETWORK = 1;
    /**
     * 本地资源图片
     */
    public static final int LOCAL = 2;



    /**
     * 网络图片
     */
    public String imgUrl;
    /**
     * 资源图片
     */
    public int imgResId;
    /**
     * 类型
     */
    public int type;


    public PhotoEntity(String imgUrl, int type) {
        this.imgUrl = imgUrl;
        this.type = type;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.imgUrl);
        dest.writeInt(this.imgResId);
        dest.writeInt(this.type);
    }

    protected PhotoEntity(Parcel in) {
        this.imgUrl = in.readString();
        this.imgResId = in.readInt();
        this.type = in.readInt();
    }

    public static final Parcelable.Creator<PhotoEntity> CREATOR = new Parcelable.Creator<PhotoEntity>() {
        @Override
        public PhotoEntity createFromParcel(Parcel source) {
            return new PhotoEntity(source);
        }

        @Override
        public PhotoEntity[] newArray(int size) {
            return new PhotoEntity[size];
        }
    };
}
